<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>gui2py: Fichero Fuente build/lib.linux-x86_64-2.7/gui/controls/notebook.py</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../edit.gif"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">gui2py
   &#160;<span id="projectnumber">0.9.3</span>
   </div>
   <div id="projectbrief">Interfaz de desarrollo de aplicaciones graficas</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generado por Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Buscar');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Página&#160;principal</span></a></li>
      <li><a href="../../namespaces.html"><span>Paquetes</span></a></li>
      <li><a href="../../annotated.html"><span>Clases</span></a></li>
      <li class="current"><a href="../../files.html"><span>Archivos</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Buscar" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="../../files.html"><span>Lista&#160;de&#160;archivos</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py_source.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>Todo</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Clases</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Archivos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Funciones</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Propiedades</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">notebook.py</div>  </div>
</div><!--header-->
<div class="contents">
<a href="../../d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py.html">Ir a la documentación de este archivo.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"><a class="line" href="../../d6/d7c/namespacegui_1_1controls_1_1notebook.html">    1</a></span>&#160;<span class="comment">#!/usr/bin/python</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"># -*- coding: utf-8 -*-</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;</div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="stringliteral">&quot;gui2py&#39;s Notebook control and TabPanel (uses wx.Notebook and wx.Panel)&quot;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;</div>
<div class="line"><a name="l00006"></a><span class="lineno"><a class="line" href="../../d6/d7c/namespacegui_1_1controls_1_1notebook.html#aacd0ceec297fdcfb45c85942cd682b05">    6</a></span>&#160;__author__ = <span class="stringliteral">&quot;Mariano Reingart (reingart@gmail.com)&quot;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"><a class="line" href="../../d6/d7c/namespacegui_1_1controls_1_1notebook.html#a3a2cadef2a9f67502ce25823f7c0a30e">    7</a></span>&#160;__copyright__ = <span class="stringliteral">&quot;Copyright (C) 2013- Mariano Reingart&quot;</span>  <span class="comment"># where applicable</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"># Initial implementation was based on PythonCard&#39;s Notebook component, </span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"># but redesigned and overhauled a lot (specs renamed, events refactorized, etc.)</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"># Note: Pythoncard&#39;s code was trivial, so it was almost reimplemented completely</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="keyword">import</span> wx</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="keyword">from</span> ..event <span class="keyword">import</span> FormEvent</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="keyword">from</span> ..component <span class="keyword">import</span> Control, Component, DesignerMixin</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="keyword">from</span> ..spec <span class="keyword">import</span> Spec, EventSpec, InitSpec, StyleSpec, InternalSpec</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="keyword">from</span> .. <span class="keyword">import</span> registry</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="keyword">from</span> .. <span class="keyword">import</span> images</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div>
<div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html">   21</a></span>&#160;<span class="keyword">class </span><a class="code" href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html">Notebook</a>(Control):</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;    <span class="stringliteral">&quot;A container which manages multiple windows with associated tabs&quot;</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;    </div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html#ac9ecb042ad4caf32c3d4418a2d9f0e6a">   24</a></span>&#160;    _wx_class = wx.Notebook</div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html#ab1683894ef6b645b1bba816ed9b4dad7">   25</a></span>&#160;    _style = wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_SIBLINGS</div>
<div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html#a3cade526de143486f2af7c452d438bb8">   26</a></span>&#160;    _image = images.notebook</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    </div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html#a05488a99f4f1072b767073cd2296e7f7">   28</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html#a05488a99f4f1072b767073cd2296e7f7">get_count</a>(self):</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;        <span class="stringliteral">&quot;Get the pages (tab) count&quot;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;        <span class="keywordflow">return</span> self.wx_obj.GetPageCount()</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;   </div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html#a7357e1a4cdaaa2d59ba265ec4b0f5735">   32</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html#a7357e1a4cdaaa2d59ba265ec4b0f5735">_get_pages</a>(self):</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;        <span class="keywordflow">return</span> [child <span class="keywordflow">for</span> child <span class="keywordflow">in</span> self <span class="keywordflow">if</span> isinstance(child, TabPanel)]</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html#a88de0e5d24d86eb3368cfca5dbdaf4c5">   35</a></span>&#160;    pages = InternalSpec(_get_pages,</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;                         doc=<span class="stringliteral">&quot;Return a list of current pages&quot;</span>)</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;                  </div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html#a4e8ff154a3060b2180d2f8d5733e072e">   38</a></span>&#160;    selection = Spec(<span class="keyword">lambda</span> self: self.wx_obj.GetSelection(), </div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;                     <span class="keyword">lambda</span> self, index: index <span class="keywordflow">is</span> <span class="keywordflow">not</span> <span class="keywordtype">None</span> <span class="keywordflow">and</span> </div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;                            wx.CallAfter(self.wx_obj.SetSelection, index),</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;                     doc=<span class="stringliteral">&quot;Currently selected page (zero based)&quot;</span>, type=<span class="stringliteral">&quot;integer&quot;</span>)</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    <span class="comment"># events:</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html#acc409c4e4887d5d60362474073218c21">   44</a></span>&#160;    onpagechanged = EventSpec(<span class="stringliteral">&#39;page_changed&#39;</span>, </div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;                         binding=wx.EVT_NOTEBOOK_PAGE_CHANGED, kind=FormEvent)</div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html#a305526edfad9a03792e03b5bea49a132">   46</a></span>&#160;    onpagechanging = EventSpec(<span class="stringliteral">&#39;page_changing&#39;</span>, </div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;                         binding=wx.EVT_NOTEBOOK_PAGE_CHANGING, kind=FormEvent)</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;                            </div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html">   51</a></span>&#160;<span class="keyword">class </span><a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html">TabPanel</a>(Component, DesignerMixin):</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <span class="stringliteral">&quot;Represents a tab (page) in the Notebook&quot;</span></div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a91975219b5c220a9e0b42ec3662d5a2c">   54</a></span>&#160;    _wx_class = wx.Panel</div>
<div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a53af97bb7de77f8755a8dd1d8c6c2029">   55</a></span>&#160;    _registry = registry.MISC</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a4817dc7a2fa46461a3982722a3594446">   57</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a4817dc7a2fa46461a3982722a3594446">__init__</a>(self, *args, **kwargs):</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;        <span class="comment"># caption is handled specially:</span></div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        <span class="keywordflow">if</span> <span class="stringliteral">&#39;text&#39;</span> <span class="keywordflow">in</span> kwargs:</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;            text = kwargs[<span class="stringliteral">&#39;text&#39;</span>]</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;            del kwargs[<span class="stringliteral">&#39;text&#39;</span>]</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;        <span class="keywordflow">else</span>:</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;            text = <span class="keywordtype">None</span></div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;        Component.__init__(self, *args, **kwargs)</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;        <span class="comment"># set index TODO: better support for insert/remove/etc</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a8e983c95b89bffc3ebc1c65413631f5e">   66</a></span>&#160;        self.<a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a31f28b913b1ef14b9fce4d60667cb2c1">index</a> = self._parent.get_count()</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;        <span class="comment"># sane default for tab caption (in designer)</span></div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;        text = text <span class="keywordflow">or</span> <span class="stringliteral">&#39;tab %s&#39;</span> % self.<a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a31f28b913b1ef14b9fce4d60667cb2c1">index</a></div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;        <span class="comment"># add the page to the notebook</span></div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;        self._parent.wx_obj.AddPage(self.wx_obj, text, self.<a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a31f28b913b1ef14b9fce4d60667cb2c1">index</a>)</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        <span class="comment"># Handle resize events to adjust absolute and relative dimensions</span></div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;        self.wx_obj.Bind(wx.EVT_SIZE, self.<a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#ad3005d686813c599a9bfe8d0b61b4b7f">resize</a>)</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;</div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a31f28b913b1ef14b9fce4d60667cb2c1">   75</a></span>&#160;    index = Spec(optional=<span class="keyword">False</span>, default=<span class="stringliteral">&quot;&quot;</span>, _name=<span class="stringliteral">&quot;_index&quot;</span>, type=<span class="stringliteral">&#39;integer&#39;</span>)</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;</div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#ad72b90459a0df16a15ae47a7fbc42064">   77</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#ad72b90459a0df16a15ae47a7fbc42064">_get_text</a>(self):</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;        <span class="keywordflow">return</span> self._parent.wx_obj.GetPageText(self.<a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a31f28b913b1ef14b9fce4d60667cb2c1">index</a>)</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;</div>
<div class="line"><a name="l00080"></a><span class="lineno"><a class="line" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a930e0f066a9478993af6a8253b37301a">   80</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a930e0f066a9478993af6a8253b37301a">_set_text</a>(self, new_text):</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;        <span class="keywordflow">if</span> self.<a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a31f28b913b1ef14b9fce4d60667cb2c1">index</a> <span class="keywordflow">is</span> <span class="keywordflow">not</span> <span class="keywordtype">None</span> <span class="keywordflow">and</span> new_text:</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;            self._parent.wx_obj.SetPageText(self.<a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a31f28b913b1ef14b9fce4d60667cb2c1">index</a>, new_text)</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    </div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a27217d8e31d1d78fbb40ba110c008825">   84</a></span>&#160;    text = Spec(_get_text, _set_text, doc=<span class="stringliteral">&quot;Tab (page) caption&quot;</span>, type=<span class="stringliteral">&#39;string&#39;</span>)</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;       </div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a903aa4ac1310ca48516ddeee854c3177">   86</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a903aa4ac1310ca48516ddeee854c3177">_get_selection</a>(self):</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;        <span class="keywordflow">return</span> self._parent.wx_obj.GetSelection() == self.<a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a31f28b913b1ef14b9fce4d60667cb2c1">index</a></div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    </div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#aad7877ffe9437197dca66a4e6cd211c8">   89</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#aad7877ffe9437197dca66a4e6cd211c8">_set_selection</a>(self, on):</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        <span class="keywordflow">if</span> on <span class="keywordflow">and</span> self._index:</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;            wx.CallAfter(self._parent.wx_obj.SetSelection, self.<a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a31f28b913b1ef14b9fce4d60667cb2c1">index</a>)</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;</div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a2b9f6964c6d83c0552f3309ae5ab5bf6">   93</a></span>&#160;    selected = Spec(_get_selection, _set_selection, type=<span class="stringliteral">&#39;boolean&#39;</span>)</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a364c967e23e9ad1100e1ad7ff47a45a6">   95</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a364c967e23e9ad1100e1ad7ff47a45a6">destroy</a>(self):</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;        <span class="comment"># remove the page to the notebook</span></div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        self._parent.wx_obj.RemovePage(self.<a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a31f28b913b1ef14b9fce4d60667cb2c1">index</a>)</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        <span class="comment"># reindex (maybe this should be moved to Notebook)</span></div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;        <span class="keywordflow">for</span> page <span class="keywordflow">in</span> self._parent.pages[self.<a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a31f28b913b1ef14b9fce4d60667cb2c1">index</a>+1:]:</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;            <span class="keywordflow">print</span> <span class="stringliteral">&quot;reindexing&quot;</span>, page.name</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;            page.index = page.index - 1</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        Component.destroy(self)</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    </div>
<div class="line"><a name="l00104"></a><span class="lineno"><a class="line" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#ad3005d686813c599a9bfe8d0b61b4b7f">  104</a></span>&#160;    <span class="keyword">def </span><a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#ad3005d686813c599a9bfe8d0b61b4b7f">resize</a>(self, evt=None):</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;        <span class="stringliteral">&quot;automatically adjust relative pos and size of children controls&quot;</span></div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;        <span class="keywordflow">for</span> child <span class="keywordflow">in</span> self:</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;            <span class="keywordflow">if</span> isinstance(child, Control):</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;                child.resize(evt)</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;        <span class="comment"># call original handler (wx.HtmlWindow)</span></div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;        <span class="keywordflow">if</span> evt:</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;            evt.Skip()</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;<span class="comment"># update metadata for the add context menu at the designer:</span></div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;Notebook._meta.valid_children = [TabPanel]</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;TabPanel._meta.valid_children = [ctr <span class="keywordflow">for</span> ctr <span class="keywordflow">in</span> registry.CONTROLS.values()</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;                                 <span class="keywordflow">if</span> ctr._image]   <span class="comment"># TODO: better filter</span></div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;TabPanel._meta.container = <span class="keyword">True</span></div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160; </div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;<span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    <span class="keyword">import</span> sys</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    <span class="comment"># basic test until unit_test</span></div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <span class="keyword">import</span> gui</div>
<div class="line"><a name="l00126"></a><span class="lineno"><a class="line" href="../../d6/d7c/namespacegui_1_1controls_1_1notebook.html#a57ce071a9a1b1ece7fe0522203067e77">  126</a></span>&#160;    app = wx.App(redirect=<span class="keyword">False</span>)    </div>
<div class="line"><a name="l00127"></a><span class="lineno"><a class="line" href="../../d6/d7c/namespacegui_1_1controls_1_1notebook.html#a48ce4374332fed1b35d149f03b1721a4">  127</a></span>&#160;    w = gui.Window(title=<span class="stringliteral">&quot;hello world&quot;</span>, name=<span class="stringliteral">&quot;frmTest&quot;</span>, tool_window=<span class="keyword">False</span>, </div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;               resizable=<span class="keyword">True</span>, visible=<span class="keyword">False</span>, pos=(180, 0))</div>
<div class="line"><a name="l00129"></a><span class="lineno"><a class="line" href="../../d6/d7c/namespacegui_1_1controls_1_1notebook.html#a4c0aa1123e1c5cf1c4f3efb1839cd628">  129</a></span>&#160;    nb = <a class="code" href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html">Notebook</a>(w, name=<span class="stringliteral">&quot;notebook&quot;</span>)</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    </div>
<div class="line"><a name="l00131"></a><span class="lineno"><a class="line" href="../../d6/d7c/namespacegui_1_1controls_1_1notebook.html#a8c9c83e06fe2bdd787af4e2413501393">  131</a></span>&#160;    p1 = <a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html">TabPanel</a>(nb, name=<span class="stringliteral">&quot;tab1&quot;</span>, text=<span class="stringliteral">&quot;panel 1&quot;</span>)</div>
<div class="line"><a name="l00132"></a><span class="lineno"><a class="line" href="../../d6/d7c/namespacegui_1_1controls_1_1notebook.html#ae26228a5c6fde1c78e47d5f0c014a1d9">  132</a></span>&#160;    p2 = <a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html">TabPanel</a>(nb, name=<span class="stringliteral">&quot;tab2&quot;</span>, text=<span class="stringliteral">&quot;panel 2&quot;</span>)</div>
<div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="../../d6/d7c/namespacegui_1_1controls_1_1notebook.html#a8e6dd03f527d684f13e707b6aa0a3da9">  133</a></span>&#160;    p3 = <a class="code" href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html">TabPanel</a>(nb, name=<span class="stringliteral">&quot;tab3&quot;</span>, text=<span class="stringliteral">&quot;panel 3&quot;</span>)</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;       </div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;    <span class="comment"># assign some event handlers:</span></div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;    nb.onpagechanged = <span class="stringliteral">&quot;print &#39;selected page:&#39;, event.target.selection&quot;</span></div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    w.show()</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    </div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;    <span class="comment"># basic tests:</span></div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    <span class="keyword">assert</span> nb.get_count() == 3</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    </div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;    <span class="keyword">from</span> <a class="code" href="../../d4/d72/namespacegui_1_1tools_1_1inspector.html">gui.tools.inspector</a> <span class="keyword">import</span> InspectorTool</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    <a class="code" href="../../df/da2/classgui_1_1tools_1_1inspector_1_1InspectorTool.html">InspectorTool</a>().show(w)</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;    app.MainLoop()</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;</div>
<div class="ttc" id="classgui_1_1controls_1_1notebook_1_1TabPanel_html_a31f28b913b1ef14b9fce4d60667cb2c1"><div class="ttname"><a href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a31f28b913b1ef14b9fce4d60667cb2c1">gui.controls.notebook.TabPanel.index</a></div><div class="ttdeci">tuple index</div><div class="ttdef"><b>Definition:</b> <a href="../../d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py_source.html#l00075">notebook.py:75</a></div></div>
<div class="ttc" id="classgui_1_1controls_1_1notebook_1_1TabPanel_html_a364c967e23e9ad1100e1ad7ff47a45a6"><div class="ttname"><a href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a364c967e23e9ad1100e1ad7ff47a45a6">gui.controls.notebook.TabPanel.destroy</a></div><div class="ttdeci">def destroy</div><div class="ttdef"><b>Definition:</b> <a href="../../d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py_source.html#l00095">notebook.py:95</a></div></div>
<div class="ttc" id="classgui_1_1controls_1_1notebook_1_1TabPanel_html_aad7877ffe9437197dca66a4e6cd211c8"><div class="ttname"><a href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#aad7877ffe9437197dca66a4e6cd211c8">gui.controls.notebook.TabPanel._set_selection</a></div><div class="ttdeci">def _set_selection</div><div class="ttdef"><b>Definition:</b> <a href="../../d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py_source.html#l00089">notebook.py:89</a></div></div>
<div class="ttc" id="classgui_1_1tools_1_1inspector_1_1InspectorTool_html"><div class="ttname"><a href="../../df/da2/classgui_1_1tools_1_1inspector_1_1InspectorTool.html">gui.tools.inspector.InspectorTool</a></div><div class="ttdef"><b>Definition:</b> <a href="../../d7/da5/build_2lib_8linux-x86__64-2_87_2gui_2tools_2inspector_8py_source.html#l00281">inspector.py:281</a></div></div>
<div class="ttc" id="classgui_1_1controls_1_1notebook_1_1TabPanel_html_a903aa4ac1310ca48516ddeee854c3177"><div class="ttname"><a href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a903aa4ac1310ca48516ddeee854c3177">gui.controls.notebook.TabPanel._get_selection</a></div><div class="ttdeci">def _get_selection</div><div class="ttdef"><b>Definition:</b> <a href="../../d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py_source.html#l00086">notebook.py:86</a></div></div>
<div class="ttc" id="classgui_1_1controls_1_1notebook_1_1Notebook_html_a05488a99f4f1072b767073cd2296e7f7"><div class="ttname"><a href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html#a05488a99f4f1072b767073cd2296e7f7">gui.controls.notebook.Notebook.get_count</a></div><div class="ttdeci">def get_count</div><div class="ttdef"><b>Definition:</b> <a href="../../d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py_source.html#l00028">notebook.py:28</a></div></div>
<div class="ttc" id="classgui_1_1controls_1_1notebook_1_1TabPanel_html_a930e0f066a9478993af6a8253b37301a"><div class="ttname"><a href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a930e0f066a9478993af6a8253b37301a">gui.controls.notebook.TabPanel._set_text</a></div><div class="ttdeci">def _set_text</div><div class="ttdef"><b>Definition:</b> <a href="../../d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py_source.html#l00080">notebook.py:80</a></div></div>
<div class="ttc" id="classgui_1_1controls_1_1notebook_1_1Notebook_html_a7357e1a4cdaaa2d59ba265ec4b0f5735"><div class="ttname"><a href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html#a7357e1a4cdaaa2d59ba265ec4b0f5735">gui.controls.notebook.Notebook._get_pages</a></div><div class="ttdeci">def _get_pages</div><div class="ttdef"><b>Definition:</b> <a href="../../d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py_source.html#l00032">notebook.py:32</a></div></div>
<div class="ttc" id="classgui_1_1controls_1_1notebook_1_1TabPanel_html_a4817dc7a2fa46461a3982722a3594446"><div class="ttname"><a href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#a4817dc7a2fa46461a3982722a3594446">gui.controls.notebook.TabPanel.__init__</a></div><div class="ttdeci">def __init__</div><div class="ttdef"><b>Definition:</b> <a href="../../d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py_source.html#l00057">notebook.py:57</a></div></div>
<div class="ttc" id="namespacegui_1_1tools_1_1inspector_html"><div class="ttname"><a href="../../d4/d72/namespacegui_1_1tools_1_1inspector.html">gui.tools.inspector</a></div><div class="ttdef"><b>Definition:</b> <a href="../../d7/da5/build_2lib_8linux-x86__64-2_87_2gui_2tools_2inspector_8py_source.html#l00001">inspector.py:1</a></div></div>
<div class="ttc" id="classgui_1_1controls_1_1notebook_1_1TabPanel_html"><div class="ttname"><a href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html">gui.controls.notebook.TabPanel</a></div><div class="ttdef"><b>Definition:</b> <a href="../../d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py_source.html#l00051">notebook.py:51</a></div></div>
<div class="ttc" id="classgui_1_1controls_1_1notebook_1_1TabPanel_html_ad72b90459a0df16a15ae47a7fbc42064"><div class="ttname"><a href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#ad72b90459a0df16a15ae47a7fbc42064">gui.controls.notebook.TabPanel._get_text</a></div><div class="ttdeci">def _get_text</div><div class="ttdef"><b>Definition:</b> <a href="../../d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py_source.html#l00077">notebook.py:77</a></div></div>
<div class="ttc" id="classgui_1_1controls_1_1notebook_1_1TabPanel_html_ad3005d686813c599a9bfe8d0b61b4b7f"><div class="ttname"><a href="../../df/d86/classgui_1_1controls_1_1notebook_1_1TabPanel.html#ad3005d686813c599a9bfe8d0b61b4b7f">gui.controls.notebook.TabPanel.resize</a></div><div class="ttdeci">def resize</div><div class="ttdef"><b>Definition:</b> <a href="../../d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py_source.html#l00104">notebook.py:104</a></div></div>
<div class="ttc" id="classgui_1_1controls_1_1notebook_1_1Notebook_html"><div class="ttname"><a href="../../d7/d30/classgui_1_1controls_1_1notebook_1_1Notebook.html">gui.controls.notebook.Notebook</a></div><div class="ttdef"><b>Definition:</b> <a href="../../d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py_source.html#l00021">notebook.py:21</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="../../dir_96a7eeec1342994a7cb0d7fe7902ae74.html">build</a></li><li class="navelem"><a class="el" href="../../dir_3740601ea11ece1a00f9273977396bc4.html">lib.linux-x86_64-2.7</a></li><li class="navelem"><a class="el" href="../../dir_5bcb0661a26d4ce62009196be9ab2e39.html">gui</a></li><li class="navelem"><a class="el" href="../../dir_4c91e8b673aaef7bf66ef8a4b005b30e.html">controls</a></li><li class="navelem"><a class="el" href="../../d4/ddc/build_2lib_8linux-x86__64-2_87_2gui_2controls_2notebook_8py.html">notebook.py</a></li>
    <li class="footer">Generado el Domingo, 7 de Diciembre de 2014 18:59:47 para gui2py por
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
  </ul>
</div>
</body>
</html>
